package com.zcs.app.lucky.helper

import kotlin.random.Random

object AnimatorHelper {
    private const val MIN_SPEED = 5
    private const val MAX_SPEED = 30
    const val ANIM_DELAY: Long = 1000 / 30
    fun calcSpeed(s: Float): Float {
        var speed = -s
        speed = if (speed > 0) {
            randomSpeed()
        } else {
            -randomSpeed()
        }
//        if (speed > MAX_SPEED)
//            speed = MAX_SPEED
//        if (speed < -MAX_SPEED)
//            speed = -MAX_SPEED
        return speed
    }

    fun randomSpeed(): Float {
        val speed = Random.nextInt(MIN_SPEED, MAX_SPEED)
        return if (Random.nextBoolean()) speed.toFloat() else (-speed).toFloat()
    }
}